package cn.lg.soar.common.util.jackson.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * Long序列化（用于全局处理后针对特殊字段做处理）
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class LongToNumberSerializer extends JsonSerializer<Long> {

    public static final LongToNumberSerializer instance = new LongToNumberSerializer();

    private LongToNumberSerializer(){}

    @Override
    public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeNumber(value);
    }
}
